package section2;
import java.io.IOException;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;

public class scriptgen {

	public static void main(String argv[]) throws IOException, InterruptedException{
		File out = new File("Cryptscript.sh");
		FileOutputStream is = new FileOutputStream(out);
        	OutputStreamWriter osw = new OutputStreamWriter(is);    
        	Writer w = new BufferedWriter(osw);
		w.write("echo START > resultCryptOCL.txt \n");
		w.write("echo START > resultCrypt.txt \n");
		for (int size=100000; size<500000000;size*=2)
		{
			for(int threads = 40; threads<30000; threads*=2)
			{
				w.write("java section2/JGFCryptOCLBenchSizeX "+threads+" "+size+" >> resultCryptOCL.txt \n");
				w.write("echo Done OCL"+threads+" "+size+"\n");
			}
			for (int threads = 2; threads <1025; threads*=2)
			{
				w.write("java section2/JGFCryptBenchSizeX "+threads+" "+size+" >> resultCrypt.txt \n");
				w.write("echo Done "+threads+" "+size+"\n");
			}
		}
		w.close();

		out = new File("Sparsescript.sh");
		is = new FileOutputStream(out);
        	osw = new OutputStreamWriter(is);    
        	w = new BufferedWriter(osw);
		w.write("echo START > resultSparseMatmultOCL.txt \n");
		w.write("echo START > resultSparse.txt \n");
		for (int size=2000; size<2000000;size*=2)
		{
			for(int threads = 40; threads<30000; threads*=2)
			{
				w.write("java section2/JGFSparseMatmultOCLBenchSizeX "+threads+" "+size+" >> resultSparseMatmultOCL.txt \n");
				w.write("echo Done OCL"+threads+" "+size+"\n");
			}
			for (int threads = 2; threads <1025; threads*=2)
			{
				w.write("java section2/JGFSparseMatmultBenchSizeX "+threads+" "+size+" >> resultSparseMatmult.txt \n");
				w.write("echo Done "+threads+" "+size+"\n");
			}
		}
		w.close();
		out = new File("Seriesscript.sh");
		is = new FileOutputStream(out);
        	osw = new OutputStreamWriter(is);    
        	w = new BufferedWriter(osw);
		w.write("echo START > resultSeriesOCL.txt \n");
		w.write("echo START > resultSeries.txt \n");
		for (int size=2000; size<2000000;size*=2)
		{
			for(int threads = 160; threads<100000; threads*=2)
			{
				w.write("java section2/JGFSeriesOCLBenchSizeX "+threads+" "+size+" >> resultSeriesOCL.txt \n");
				w.write("echo Done OCL"+threads+" "+size+"\n");
			}
			for (int threads = 2; threads <1025; threads*=2)
			{
				w.write("java section2/JGFSeriesBenchSizeX "+threads+" "+size+" >> resultSeries.txt \n");
				w.write("echo Done "+threads+" "+size+"\n");
			}
		}
		w.close();
	}
}
		

